﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;

namespace MultipleDB.Entitys
{
    /// <summary>
    /// 用户
    /// </summary>
    [Tenant("1")]//对应ConfigId=1
    public class SysUser
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Newtonsoft.Json.JsonConverter(typeof(ValueToStringConverter))]
        [SugarColumn(IsPrimaryKey = true)]
        public long Id { get; set; } = YitIdHelper.NextId();

        /// <summary>
        /// 账号
        /// </summary>
        public string Account { get; set; }

        /// <summary>
        /// 密码(加密的密文)
        /// </summary>
        public string PassWord { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 性别：0女，1男
        /// </summary>
        public bool Sex { get; set; }

        /// <summary>
        /// 类型：1内部，2供应商，3客户
        /// </summary>
        public byte Type { get; set; }

        /// <summary>
        /// 组织ID
        /// </summary>
        public long OrganizeId { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string EMail { get; set; }

        /// <summary>
        /// 联系地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 角色(这个非常重要 Web Api 访问权限),分别为:刷新令牌,外部用户,普通用户,一般管理员,系统管理员
        /// </summary>
        public string RoleName { get; set; }

        /// <summary>
        /// 是否启用：0否，1是，默认1
        /// </summary>
        public bool IsEnable { get; set; }

        /// <summary>
        /// 是否删除：0否，1是，默认0
        /// </summary>
        public bool IsDelete { get; set; }

        /// <summary>
        /// 登录次数
        /// </summary>
        public int LoginCount { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        public System.DateTime LastLoginTime { get; set; }

        /// <summary>
        /// 创建用户
        /// </summary>
        public string CreateAccount { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public System.DateTime CreateTime { get; set; }

        /// <summary>
        /// 修改用户
        /// </summary>
        public string UpdateAccount { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public System.DateTime UpdateTime { get; set; }
    }
}
